﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

[Serializable]
public class StockServiceEntity
{
    public string StockId { get; set; }
    public string StockName { get; set; }
    public string LowPrice { get; set; }
    public string HighPrice { get; set; }

}

[Serializable]
public class StockService : ServiceBase
{
    public const  int ItemPrice = 2;
    public StockService()
    {
        this.entities = new List<StockServiceEntity>();
        //this.entities.Add(new StockServiceEntity() { StockId = "sh600001", HighPrice = "12.25", LowPrice = "11.21" });
    }

    private List<StockServiceEntity> entities;

    public List<StockServiceEntity> Entities
    {
        get
        {
            return this.entities;
        }
        set
        {
            this.entities = value;
        }
    }

    public List<StockServiceEntity> Select()
    {
        return this.entities;
    }

    public void Update(int ListIndex, string StockId, string StockName, string HighPrice, string LowPrice)
    {
        entities[ListIndex].StockId = StockId;
        entities[ListIndex].StockName = StockName;
        entities[ListIndex].HighPrice = HighPrice;
        entities[ListIndex].LowPrice = LowPrice;
    }

    public void Delete(int ListIndex)
    {
        this.entities.RemoveAt(ListIndex);
    }
}